//
//  RBHomeGuessCell.m
//  zhongzhenglu
//
//  Created by XL on 2022/5/26.
//

#import "RBHomeGuessCell.h"
#import "RBDefine.h"
#import "RanTool.h"
#import <YYCategories.h>
#import "UIView+RBAdd.h"
#import "UIImageView+RBAdd.h"
#import "RBHomeGuessResponse.h"

@interface RBHomeGuessCell()

@property(nonatomic, strong)IBOutlet UIImageView *imgView;
@property(nonatomic, strong)IBOutlet UILabel *titleL;
@property(nonatomic, strong)IBOutlet UILabel *desL;
@property(nonatomic, strong)IBOutlet UILabel *priceL;
@property(nonatomic, strong)IBOutlet UILabel *origPriceL;
@property(nonatomic, strong)IBOutlet UIView *origPriceLineView;

@end

@implementation RBHomeGuessCell

- (void)awakeFromNib
{
    [super awakeFromNib];
    [self zoomSubViewsWithSelf];
}

+ (CGSize)suggestSize
{
    return CGSizeMake(Zoom(167), Zoom(242));
}

+ (CGFloat)margin
{
    return 15;
}

+ (CGFloat)padding
{
    return 10;
}

#pragma mark - Setter

- (void)setCellModel:(RBCellModel *)cellModel
{
    RBHomeGuessModel *model = cellModel.cellData;
    [self.imgView setImageWithUrl:model.picurl placeHolder:nil];
    self.titleL.text = model.good_name;
    self.desL.text = model.remark;
    UIColor *priceColor = [UIColor colorWithHexString:@"#F25B50"];
    self.priceL.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(10)] color:priceColor string:@"¥"];
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(16)] color:priceColor string:model.sell_price];
    }];
    UIColor *oriPriceColor = [UIColor colorWithHexString:@"#AEAEAE"];
    self.origPriceL.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(12)] color:oriPriceColor string:@"¥"];
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(12)] color:oriPriceColor string:model.shop_price];
    }];
    self.origPriceLineView.backgroundColor = oriPriceColor;
}

#pragma mark - Getter


@end
